// 请求响应参数（不包含data）
export interface Result {
  code: string;
  msg: string;
}

// 请求响应参数（包含data）
export interface ResultData<T = any> extends Result {
  data: T;
}

// 分页响应参数
export interface ResPage<T> {
  list: T[];
  pageNum: number;
  pageSize: number;
  total: number;
}

// 分页请求参数
export interface ReqPage {
  pageNum: number;
  pageSize: number;
}

// 文件上传模块
export namespace Upload {
  export interface ResFileUrl {
    fileUrl: string;
  }
}

// 商品模块
export namespace Goods {
  export interface ResGoods {
    id: number;
    name: string;
    code: string;
    price: number;
    pictures: [
      {
        name: string;
        url: string;
      }
    ];
    desc: string;
    categoryName: string;
    conditionName: string;
    stock: number;
  }

  export interface ReqGoods {
    id: number;
  }
}

// 分类模块
export namespace Category {
  export interface ResCategory {
    id: number;
    name: string;
    picture: string;
    parentName: string;
  }

  export interface ReqCategory {
    id: number | null;
    name: string | null;
  }
}

// 登录模块
export namespace Login {
  export interface ReqLoginForm {
    username: string;
    password: string;
  }

  export interface ResLogin {
    userInfo: {
      id: number;
      username: string;
      avatar: string;
      roleNames: string[];
      gender: number;
      age: number;
      idCard: string;
      email: string;
      address: string;
    };
    token: string;
  }

  export interface ResAuthButtons {
    [key: string]: string[];
  }
}

// 日志管理模块
export namespace Log {
  export interface ResLogList {
    id: number;
    username: string;
    timestamp: string;
    logLevel: string;
    logMessage: string;
    logSource: string;
    inputParameters: string;
    operationResult: string;
    exceptionInfo: string;
    ipAddress: string;
    requestMethod: string;
    requestUrl: string;
  }

  export interface ReqLogParams {
    username: string;
    startTime: string;
    endTime: string;
    logLevel: string;
    requestMethod: string;
  }

  export interface Level {
    logLabel: string;
    logValue: number;
  }

  export interface Method {
    methodLabel: string;
    methodValue: string;
  }
}

// 消息模块
export namespace Message {
  export interface ResMessage {
    id: number;
    messageType: string;
    title: string;
    content: string;
    read: number;
    createTime: string;
  }
  export interface ReqMessage {
    id: number;
    read: number;
  }
}

// 数据统计模块
export namespace Statistic {
  export interface ResStatistic {
    totalHits: number;
    todayHits: number;
    yesterdayHits: number;
    femaleHits: number;
    maleHits: number;
    guestHits: number;
    userHits: number;
    curveDatas: curveData[];
  }
  export interface curveData {
    value: number;
    spotName: string;
  }
  export interface ResTab {
    label: string;
    name: number;
  }
}

// 订单管理
export namespace Order {
  export interface ResOrder {
    id: number;
    orderNo: string;
    status: number;
    amount: number;
    createTime: string;
    updateTime: string;
    receiver: string;
    buyer: string;
    payType: string;
    deliveryType: string;
    address: string;
    contract: string;
    payTime: string;
    confirmTime: string;
    completeTime: string;
    deliveryTime: string;
  }
  export interface ReqOrder {
    id: number;
    orderNo: string;
  }
}

// 轮播图
export namespace Rotate {
  export interface ResRotate {
    id: number;
    imgUrl: string;
    hrefUrl: string;
    type: string;
  }

  export interface ReqRotate {
    id: number;
  }
}

// 用户管理模块
export namespace User {
  export interface ReqUserParams extends ReqPage {
    username: string;
    gender: number;
    idCard: string;
    email: string;
    address: string;
    createTime: string[];
    status: number;
  }

  export interface ReqUpdatePassword {
    password: string;
  }

  export interface ResUserList {
    id: string;
    username: string;
    roleNames: string[];
    gender: number;
    age: number;
    idCard: string;
    email: string;
    address: string;
    createTime: string;
    status: number;
    avatar: string;
    photo: any[];
    children?: ResUserList[];
  }

  export interface ResStatus {
    userLabel: string;
    userValue: number;
  }

  export interface ResGender {
    genderLabel: string;
    genderValue: number;
  }

  export interface ResDepartment {
    id: string;
    name: string;
    children?: ResDepartment[];
  }

  export interface ResRole {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
}

export namespace Permission {
  export interface ResPermission {
    id: number;
    permissionName: string;
  }
}

export namespace Route {
  export interface ResRoute {
    id: number;
    path: string;
    name: string;
    component: string;
    redirect: string;
    meta: {
      icon: string;
      title: string;
      activeMenu: string;
      isLink: string;
      isHide: boolean;
      isFull: boolean;
      isAffix: boolean;
      isKeepAlive: boolean;
    };
    children: ResRoute[];
  }
}

// 按钮管理模块
export namespace Button {
  export interface ResButton {
    id: number;
    buttonAuth: string;
    createTime: string;
    updateTime: string;
  }

  export interface ReqButton {
    buttonAuth: string;
  }
}

// 角色管理模块
export namespace Role {
  export interface ResRoleList {
    id: number;
    roleName: string;
    roleStr: string;
    status: number;
    createTime: string;
    updateTime: string;
    routes: number[];
    permissions: number[];
  }

  export interface ResStatus {
    roleLabel: string;
    roleValue: number;
  }

  export interface ReqRoleParams {
    roleName: string;
    status: number;
    createTime: string[];
  }
}
